using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Minesweeper02
{
	/// <summary>
	/// Summary description for NewBestTime.
	/// </summary>
	public class NewBestTime : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label DescriptionLabel;
		private System.Windows.Forms.TextBox PlayerName;
		private System.Windows.Forms.Button OkButton;
		private string level;
		private int time;
		private string lastplayername;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public NewBestTime(string _level,int _time,string _lastplayername)
		{
			//
			// Required for Windows Form Designer support
			//
			level=_level;
            time=_time;
			lastplayername=_lastplayername;
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.DescriptionLabel = new System.Windows.Forms.Label();
			this.PlayerName = new System.Windows.Forms.TextBox();
			this.OkButton = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// DescriptionLabel
			// 
			this.DescriptionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.DescriptionLabel.Location = new System.Drawing.Point(16, 16);
			this.DescriptionLabel.Name = "DescriptionLabel";
			this.DescriptionLabel.Size = new System.Drawing.Size(152, 120);
			this.DescriptionLabel.TabIndex = 0;
			this.DescriptionLabel.Text = "You have the fastest Time in "+level+" Level  Please Enter your name";
			this.DescriptionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// PlayerName
			// 
			this.PlayerName.Location = new System.Drawing.Point(24, 144);
			this.PlayerName.Name = "PlayerName";
			this.PlayerName.Size = new System.Drawing.Size(136, 20);
			this.PlayerName.TabIndex = 1;
			this.PlayerName.Text = lastplayername;
			// 
			// OkButton
			// 
			this.OkButton.Location = new System.Drawing.Point(56, 176);
			this.OkButton.Name = "OkButton";
			this.OkButton.Size = new System.Drawing.Size(72, 32);
			this.OkButton.TabIndex = 2;
			this.OkButton.Text = "Ok";
			this.OkButton.Click += new System.EventHandler(this.OkButton_Click);
			// 
			// NewBestTime
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.ClientSize = new System.Drawing.Size(176, 224);
			this.Controls.Add(this.OkButton);
			this.Controls.Add(this.PlayerName);
			this.Controls.Add(this.DescriptionLabel);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			this.Name = "NewBestTime";
			this.Text = "NewBestTime";
			this.ResumeLayout(false);

		}
		#endregion

		private void OkButton_Click(object sender, System.EventArgs e)
		{
		    MineResourceSet rs=new MineResourceSet("Play.resources");
            rs.SaveBestTime(level,time.ToString(),this.PlayerName.Text);
			this.Close();
		}
	}
}
